<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../static/js/jquery.min.js"></script>
    <script src="/static/js/bootstrap.min.js"></script>
    <script src="/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script src="/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <link rel="stylesheet" href="/static/css/heightlength.css">
    <link rel="stylesheet" href="/static/css/mxjs.css">
    <link rel="stylesheet" href="/static/datetimepicker/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="../../static/css/heightlength.css">
    <link rel="stylesheet" href="../../static/css/mxjs.css">
    <style>
        *{
            font-size: 10px;

        }
    </style>
    <script>
        $(function () {

            if (document.referrer=="") {
                $("#bb").hide();
                var hostname=location.hostname;
                var port=location.port;
                var trueUri="http://"+hostname+":"+port+"/dw/"
                window.location.href=trueUri;
            }

            // alert(window.location.href);

        });
        function cx() {
            debugger
            var name=$("#name").val();
            var idc=$("#idc").val();
            if (name=="" && idc==""){
                alert("请输入查询条件");
            } else  {
                if (name=="") name="1";
                if (idc=="") idc="0";
            }
                $.ajax({
                    url:'grcx',
                    type:'POST',
                    data:{name:name,idc:idc},
                    success:function (data) {
                        //debugger;
                        $("#ret").show();
                        if (data.status=="true"){
                            var ss="个人体检结果查询";
                            if ((name!="1"&&idc!="0")||name!="1"){
                                ss+=">> 按姓名模糊查找"
                            }else {ss+=">>按体检编码查找"}

                            $("#show").text(ss);
                            $("#tj").hide();
                            $("#res").show();
                            var str="";
                            $("#tb").empty();
                            $("#time").append(data.msg);
                            $("#count").append(data.data.length);
                            $.each(data.data,function(commendIndex,comment){
                                str +="<tr>"+
                                    "<td>"+comment['tjbm']+"</td>"+
                                    "<td>"+comment['idc']+"</td>"+
                                    "<td><a href='../tj/my?idx="+comment['idx']+"' target='_blank' >"+comment['name']+"</td>"+
                                    "<td>"+comment['sex']+"</td>"+
                                    "<td>"+comment['age']+"</td>";
                                if (comment['wrkstanam']!=null) {
                                    str+= "<td>" + comment['wrkstanam'] + "</td>" ;
                                }else {
                                    str+="<td></td>";
                                }
                                if (comment['dpt']!=null) {
                                    str+= "<td>" + comment['dpt'] + "</td>" ;
                                }else {
                                    str+="<td></td>";
                                }
                                if (comment['wrknum']!=null) {
                                    str+= "<td>" + comment['wrknum'] + "</td>" ;
                                }else {
                                    str+="<td></td>";
                                }
                                if (comment['bhkdat']!=null) {
                                    str+= "<td>" + comment['bhkdat'] + "</td>" ;
                                }else {
                                    str+="<td></td>";
                                }
                                if (comment['tjjg']!=null || comment['jy']!=null){
                                    str+= "<td>"+comment['tjjg']+"<br/>"+comment['jy']+"</td>"+
                                        "</tr>";
                                }else {
                                    str+='<td>本次体检未结束，暂不能查询</td></tr>';
                                }

                            });
                            $("#tb").append(str);
                        }
                    }
                })
        }
        function  cl() {
            $("#tb").empty();
            $("#res").hide();
            $("#tj").show();
            $("#ret").hide();
            $("#time").empty();
            $("#count").empty();
        }
    </script>
</head>
<body style="background-color: white">

        <div class="col-lg-12" style="font-size: 8px">
            <div class="mx-1">
                <span>当前位置>> <i id="show">个人信息查询</i></span>
                <span id="ret" style="float: right;margin-right: 3%;color: black" hidden onclick="cl()"><a ><i>返回</i></a></span>
            </div>
        </div>
        <div class="col-lg-12"  id="tj">
              <pre class="">
                  <span style="">请输入查询条件</span>
                  <table width="40%" >
                      <tr>
                          <td colspan="4"></td>
                      </tr>
                      <tr>
                          <td style="text-align: right">按姓名查询:</td>
                          <td><input style="" type="text" class="form-control" id="name"   placeholder=""></td>
                      </tr>
                      <tr><td colspan="2" style="text-align: center">或</td></tr>
                      <tr>
                          <td style="text-align:right ">按体检编号查询:</td>
                          <td><input type="number"  class="form-control" id="idc"  value=""  placeholder="" ></td>
                      </tr>
                  </table>

                  <button onclick="cx()" style="margin-left: 5%">查询</button>

            </pre>
        </div>
        <div class="col-lg-12  " id="res" hidden>
            <center>
                  <span >您输入的条件为：<i id="time"></i> &nbsp;&nbsp;共有<i id="count"></i>条数据</span>
                  <table style="width: 100%" border="1" cellpadding="0" cellspacing="0">
                      <thead>
                      <th>体检编码</th>
                      <th>身份证号</th>
                      <th width="70px">姓名</th>
                      <th width="40">性别</th>
                      <th width="40">年龄</th>
                      <th width="70px">在岗状态</th>
                      <th width="40">部门</th>
                      <th width="40">工号</th>
                      <th width="100px">体检日期</th>
                      <th>结论及建议</th>
                      </thead>
                      <tbody id="tb">

                      </tbody>
                  </table>
            </center>
        </div>

</body>
</html>